package com.xuyiwei.mayi.controller;

import com.xuyiwei.mayi.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by xuyiwei on 2019/4/18.
 */
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/register")
    public String register(String name,String pwd){
        userService.register(name,pwd);
        return "注册成功";
    }
    @RequestMapping("/getName")
    public String getName(Long id){
        String name = userService.getName(id);
        return name;
    }

    @RequestMapping("/insertData")
    public String insertData( ){
        userService.insertData();
        return "插入成功";
    }
}
